#include "xmlDep.h"
#include "depproperty.h"
#include "defaultstateproperty.h"

xmlDep::xmlDep()
{
    this->distribution = new cdf();
    this->isMergedDep = false;
    this->jumpIsNotClickable = false;
    //this->numTriggerCircleDep = 0;
}

QString xmlDep::getTriggerId()
{
    return this->triggerId;
}

QString xmlDep::getTriggerEvType()
{
    return this->triggerEvType;
}

QString xmlDep::getTriggerEvFinalStateId()
{
    return this->triggerEvFinalStateId;
}

QString xmlDep::getReactionEvType()
{
    return this->reactionEvType;
}

QString xmlDep::getReactionEvFinalStateId()
{
    return this->reactionEvFinalStateId;
}

QStringList xmlDep::getInitState()
{
    return this->initState;
}

void xmlDep::setTriggerId(QString value)
{
    this->triggerId = value;
}

void xmlDep::setTriggerEvType(QString value)
{
    this->triggerEvType = value;
}

void xmlDep::setTriggerEvFinalStateId(QString value)
{
    this->triggerEvFinalStateId = value;
}

void xmlDep::setReactionEvType(QString value)
{
    this->reactionEvType = value;
}

void xmlDep::setReactionEvFinalStateId(QString value)
{
    this->reactionEvFinalStateId = value;
}

void xmlDep::setInitState(QStringList value)
{
    this->initState = value;
}

void xmlDep::setIsPainted(bool value)
{
    this->isPainted = value;
}

bool xmlDep::getIsPainted()
{
    return this->isPainted;
}

void xmlDep::setPriority(QString value)
{
    this->priority = value;
}

void xmlDep::setPropProbability(QString value)
{
    this->propProbability = value;
}

QString xmlDep::getPriority()
{
    return this->priority;
}

QString xmlDep::getPropProbability()
{
    return this->propProbability;
}

void xmlDep::setIsMergedDep(bool value)
{
    this->isMergedDep = value;
}

bool xmlDep::getIsMergedDep()
{
    return this->isMergedDep;
}

QString xmlDep::getLogicConditionalCircleDep()
{
    return this->logicConditionalCircleDep;
}

void xmlDep::setCdfFromParser(cdf * distribution)
{
    this->distribution = distribution;
}

void xmlDep::setCdf(QString  typeCdf, depproperty *myForm, int num_dep)
{
    switch(num_dep)
    {
        case 1:
            if(typeCdf == "Weibull")
            {
                cdfWeibull * distribution = new cdfWeibull();
                distribution->setType(typeCdf);
                distribution->setKappa(myForm->lineEdit_kappa->text());
                distribution->setLambda(myForm->lineEdit_lambda->text());
                this->distribution = distribution;

            }
            else if(typeCdf == "Erlang")
            {
                cdfErlang * distribution = new cdfErlang();
                distribution->setType(typeCdf);
                distribution->setAlfa(myForm->lineEdit_alfa->text());
                distribution->setErre(myForm->lineEdit_erre->text());
                this->distribution = distribution;

            }
            else if(typeCdf == "Uniforme")
            {
                cdfUniforme * distribution = new cdfUniforme();
                distribution->setType(typeCdf);
                distribution->setA(myForm->lineEdit_a->text());
                distribution->setB(myForm->lineEdit_b->text());
                this->distribution = distribution;

            }
            else if(typeCdf == "Not repairable")
            {
                cdf * distribution = new cdf();
                distribution->setType(typeCdf);
                this->distribution = distribution;
            }
            break;

        case 2:
            if(typeCdf == "Weibull")
            {
                cdfWeibull * distribution = new cdfWeibull();
                distribution->setType(typeCdf);
                distribution->setKappa(myForm->lineEdit_kappa_2->text());
                distribution->setLambda(myForm->lineEdit_lambda_2->text());
                this->distribution = distribution;

            }
            else if(typeCdf == "Erlang")
            {
                cdfErlang * distribution = new cdfErlang();
                distribution->setType(typeCdf);
                distribution->setAlfa(myForm->lineEdit_alfa_3->text());
                distribution->setErre(myForm->lineEdit_erre_3->text());
                this->distribution = distribution;

            }
            else if(typeCdf == "Uniforme")
            {
                cdfUniforme * distribution = new cdfUniforme();
                distribution->setType(typeCdf);
                distribution->setA(myForm->lineEdit_a_2->text());
                distribution->setB(myForm->lineEdit_b_2->text());
                this->distribution = distribution;

            }
            else if(typeCdf == "Not repairable")
            {
                cdf * distribution = new cdf();
                distribution->setType(typeCdf);
                this->distribution = distribution;
            }
            break;

        case 3:
            if(typeCdf == "Weibull")
            {
                cdfWeibull * distribution = new cdfWeibull();
                distribution->setType(typeCdf);
                distribution->setKappa(myForm->lineEdit_kappa_3->text());
                distribution->setLambda(myForm->lineEdit_lambda_3->text());
                this->distribution = distribution;

            }
            else if(typeCdf == "Erlang")
            {
                cdfErlang * distribution = new cdfErlang();
                distribution->setType(typeCdf);
                distribution->setAlfa(myForm->lineEdit_alfa_4->text());
                distribution->setErre(myForm->lineEdit_erre_4->text());
                this->distribution = distribution;

            }
            else if(typeCdf == "Uniforme")
            {
                cdfUniforme * distribution = new cdfUniforme();
                distribution->setType(typeCdf);
                distribution->setA(myForm->lineEdit_a_3->text());
                distribution->setB(myForm->lineEdit_b_3->text());
                this->distribution = distribution;

            }
            else if(typeCdf == "Not repairable")
            {
                cdf * distribution = new cdf();
                distribution->setType(typeCdf);
                this->distribution = distribution;
            }
            break;

        case 4:
            if(typeCdf == "Weibull")
            {
                cdfWeibull * distribution = new cdfWeibull();
                distribution->setType(typeCdf);
                distribution->setKappa(myForm->lineEdit_kappa_4->text());
                distribution->setLambda(myForm->lineEdit_lambda_4->text());
                this->distribution = distribution;

            }
            else if(typeCdf == "Erlang")
            {
                cdfErlang * distribution = new cdfErlang();
                distribution->setType(typeCdf);
                distribution->setAlfa(myForm->lineEdit_alfa_5->text());
                distribution->setErre(myForm->lineEdit_erre_5->text());
                this->distribution = distribution;

            }
            else if(typeCdf == "Uniforme")
            {
                cdfUniforme * distribution = new cdfUniforme();
                distribution->setType(typeCdf);
                distribution->setA(myForm->lineEdit_a_4->text());
                distribution->setB(myForm->lineEdit_b_4->text());
                this->distribution = distribution;

            }
            else if(typeCdf == "Not repairable")
            {
                cdf * distribution = new cdf();
                distribution->setType(typeCdf);
                this->distribution = distribution;
            }
            break;

        case 5:
            if(typeCdf == "Weibull")
            {
                cdfWeibull * distribution = new cdfWeibull();
                distribution->setType(typeCdf);
                distribution->setKappa(myForm->lineEdit_kappa_5->text());
                distribution->setLambda(myForm->lineEdit_lambda_5->text());
                this->distribution = distribution;

            }
            else if(typeCdf == "Erlang")
            {
                cdfErlang * distribution = new cdfErlang();
                distribution->setType(typeCdf);
                distribution->setAlfa(myForm->lineEdit_alfa_6->text());
                distribution->setErre(myForm->lineEdit_erre_6->text());
                this->distribution = distribution;

            }
            else if(typeCdf == "Uniforme")
            {
                cdfUniforme * distribution = new cdfUniforme();
                distribution->setType(typeCdf);
                distribution->setA(myForm->lineEdit_a_5->text());
                distribution->setB(myForm->lineEdit_b_5->text());
                this->distribution = distribution;

            }
            else if(typeCdf == "Not repairable")
            {
                cdf * distribution = new cdf();
                distribution->setType(typeCdf);
                this->distribution = distribution;
            }
            break;

    }

}

cdf * xmlDep::getCdf()
{
    return this->distribution;
}

void xmlDep::setLogicConditionalCircleDep(QString value)
{
    this->logicConditionalCircleDep = value;
}

void xmlDep::setNumMyCircleDep(int value)
{
    this->numMyCircleDep = value;
}

int xmlDep::getNumMyCircleDep()
{
    return this->numMyCircleDep;
}

void xmlDep::setIsLon(int value)
{
    this->isLon = value;
}

int xmlDep::getIsLon()
{
    return this->isLon;
}

/*void xmlDep::setNumTriggerCircleDep(int value)
{
    this->numTriggerCircleDep = value;
}

int xmlDep::getNumTriggerCircleDep()
{
    return this->numTriggerCircleDep;
}*/

/*void xmlDep::setMyCircleDep(circleDep *value)
{
    this->myCircle = value;
}

circleDep *xmlDep::getMyCircleDep()
{
    return this->myCircle;
}*/

void xmlDep::setJumpIsNotClickable(bool value)
{
    this->jumpIsNotClickable = value;
}

bool xmlDep::getJumpIsNotClickable()
{
    return this->jumpIsNotClickable;
}

void xmlDep::setXcircleDep(QString value)
{
    this->xCircleDep = value.toDouble();
}

void xmlDep::setYcircleDep(QString value)
{
    this->yCircleDep = value.toDouble();
}

double xmlDep::getXcircleDep()
{
    return this->xCircleDep;
}

double xmlDep::getYcircleDep()
{
    return this->yCircleDep;
}

void xmlDep::setCdf(QString typeCdf, defaultstateproperty *myForm)
{
    if(typeCdf == "Weibull")
    {
        cdfWeibull * distribution = new cdfWeibull();
        distribution->setType(typeCdf);
        distribution->setKappa(myForm->lineEdit_kappa_5->text());
        distribution->setLambda(myForm->lineEdit_lambda_5->text());
        this->distribution = distribution;

    }
    else if(typeCdf == "Erlang")
    {
        cdfErlang * distribution = new cdfErlang();
        distribution->setType(typeCdf);
        distribution->setAlfa(myForm->lineEdit_alfa_6->text());
        distribution->setErre(myForm->lineEdit_erre_6->text());
        this->distribution = distribution;

    }
    else if(typeCdf == "Uniforme")
    {
        cdfUniforme * distribution = new cdfUniforme();
        distribution->setType(typeCdf);
        distribution->setA(myForm->lineEdit_a_5->text());
        distribution->setB(myForm->lineEdit_b_5->text());
        this->distribution = distribution;

    }
    else if(typeCdf == "Not repairable")
    {
        cdf * distribution = new cdf();
        distribution->setType(typeCdf);
        this->distribution = distribution;
    }
}
